<%@ include file="/WEB-INF/template/include.jsp"%>
<%@ include file="localHeader.jsp"%>
<openmrs:require privilege="View Orders" otherwise="/login.htm" redirect="module/simplelabentry/orderEntry.htm" />

<openmrs:htmlInclude file="/scripts/calendar/calendar.js" />
<br/>
    <form id="orderEntry" action="orderEntry.htm" method="get">
        <b class="boxHeader">Step 1.  Choose patient for adding Confidential Test:</b>
        <div class="box" >

            <div align="center">
                    Enter Patient ID/Name:
                    <input type="text" name="identifier" id="identifier" class="orderField" value="${param.identifier}" />
                    <input type="button" onclick="submitForm()" value="<spring:message code="general.submit" />"/>

            </div>
        </div>
    </form>
        <br/>

        <c:if test="${!empty param.identifier}">
            <openmrs:portlet
                url="orderEntry"
                id="orderEntrySectionId"
                moduleId="simplelabentry"
                parameters="confidentialTest=true|allowAdd=true|allowDelete=nonResults|orderLocation=1|orderDate=|identifier=${param.identifier}" />
        </c:if>


<script type="text/javascript">
    function submitForm(){
        var identifier = document.getElementById('identifier').value;
        if(identifier!=null && identifier!="")
        {
            if(!lettersonly(identifier))
            {
                alert("Please enter valid identifier");
                document.getElementById('identifier').value = "";
            }
			else
			{
				document.getElementById('orderEntry').submit();
			}
        }

    }

    function lettersonly(value) {
        return /^[a-z0-9\-\s]+$/i.test(value);
    }

</script>

<%@ include file="/WEB-INF/template/footer.jsp"%>
